import java.util.Random;

/**
 * @author jmaria_iturbe
 *
 */
public class Dice {
	
	/**
	 * @param args
	 */
	private int sides=0; 
	private boolean admitsZero = true;
	private char[] rollTheDice;
	public Dice (){
		sides=6;
	}
	
	/**
	 * Method to generate a d6
	 * @param sides
	 */
	public Dice (int sides){
		this.sides=sides;
	}
	
	/**
	 * Method to generate a dice of given size with zeroes managing
	 * @param sides
	 * @param admitsZero
	 */
	public Dice (int sides, boolean admitsZero){
		this.sides=sides;
		this.admitsZero=admitsZero;
	}
	
	/**
	 * Method to generate a dice roll
	 * @return
	 */
	public int rollTheDice (){
		Random random = new Random();
		if (admitsZero){
			return random.nextInt(sides);
		}else{
			return random.nextInt(sides)+1;
			
		}
			
	}
	/**
	 * Main method
	 * @param args
	 */
	public static void main(String[] args) {
	Dice random =new Dice();
	Dice numero =new Dice(9);
	Dice side = new Dice(5,true);
	System.out.println(random.rollTheDice);
	System.out.println(numero.rollTheDice);
	System.out.println(side.rollTheDice);

	}



}
